home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / util / moni / Scout-src.lha / source / objects / scout_system.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-02-13  |  19.8 KB  |  560 lines

  1. /**
  2.  * Scout - The Amiga System Monitor
  3.  *
  4.  *------------------------------------------------------------------
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; either version 2 of the License, or
  9.  * any later version.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program; if not, write to the Free Software
  18.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  *
  20.  * You must not use this source code to gain profit of any kind!
  21.  *
  22.  *------------------------------------------------------------------
  23.  *
  24.  * @author Andreas Gelhausen
  25.  * @author Richard Körber <rkoerber@gmx.de>
  26.  */
  27.  
  28.  
  29.  
  30. #include "system_headers.h"
  31.  
  32. static APTR SysPool = NULL;
  33.  
  34. __asm __saveds LONG syslist_dspfunc(register __a2 char **array, register __a1 struct SystemEntry *sysentry, register __a0 struct Hook *hook)
  35. {
  36.    if (sysentry) {
  37.       *array++ = sysentry->syse_desc;
  38.       *array   = sysentry->syse_line;
  39.    }
  40.    return(0);
  41. }
  42.  
  43. struct Hook syslist_dsphook = {
  44.  {NULL, NULL},
  45.  (ULONG (* )())syslist_dspfunc,
  46.  NULL, NULL
  47. };
  48.  
  49. void FreeSystem (void)
  50. {
  51.     MyFreePoolStructs(&SysPool, systext, NULL, syslist);
  52. }
  53.  
  54. static struct SystemEntry * genentry(struct SystemEntry **first, struct SystemEntry **previous, int *syscnt)
  55. {
  56.   struct SystemEntry *sysentry;
  57.  
  58.   if(sysentry = tbAllocPooled(SysPool, sizeof(struct SystemEntry))) {
  59.     if (! *first)
  60.        *first = sysentry;
  61.     if (*previous)
  62.        (*previous)->syse_next = sysentry;
  63.     (*syscnt)++;
  64.     *previous = sysentry;
  65.   }
  66.   return(sysentry);
  67. }
  68.  
  69. STRPTR MyIdHardware(ULONG num)
  70. {
  71.   return IdHardwareTags(num,IDTAG_Localize,FALSE,TAG_DONE);
  72. }
  73. int MyIdCheck(ULONG num)
  74. {
  75.   return (int)IdHardwareTags(num,IDTAG_NULL4NA,TRUE,TAG_DONE);
  76. }
  77.  
  78. void DateToInt( struct DateStamp *ds,
  79.                 ULONG *u )
  80. {
  81.     *u = SMult32(ds->ds_Days, 86400) +
  82.          SMult32(ds->ds_Minute, 60) +
  83.          SDivMod32(ds->ds_Tick, TICKS_PER_SECOND);
  84. }
  85.  
  86. void IntToDate( ULONG r,
  87.                 struct DateStamp *ds )
  88. {
  89.     ds->ds_Days = UDivMod32(r, 86400);
  90.  
  91.     r = getreg(REG_D1);
  92.     ds->ds_Minute = UDivMod32(r, 60);
  93.  
  94.     r = getreg(REG_D1);
  95.     ds->ds_Tick = UMult32(r, TICKS_PER_SECOND);
  96. }
  97.  
  98. int GetSystem (struct SystemEntry **first) {
  99.    struct   SystemEntry    *sysentry,*previous = NULL;
  100.    int syscnt = 0;
  101.  
  102.    ULONG cacr = GetCACR(); /* 68020..68060 */
  103.    ULONG pcr  = GetPCR();  /* 68060 */
  104.    UWORD attn = SysBase->AttnFlags;
  105.  
  106.    *first = 0;
  107.  
  108.    if (!SysPool) SysPool = tbCreatePool(MEMF_CLEAR, 4096, 4096);
  109.  
  110.    if (clientstate) {
  111.       if (SendDaemon ("GetSysList")) {
  112.          while ((sysentry = tbAllocPooled(SysPool, sizeof(struct SystemEntry))) \
  113.            && (ReceiveDecodedEntry ((UBYTE *) sysentry, sizeof (struct SystemEntry)))) {
  114.  
  115.             if (! *first)
  116.                *first = sysentry;
  117.             if (previous)
  118.                previous->syse_next = sysentry;
  119.  
  120.             syscnt++;
  121.             previous = sysentry;
  122.          }
  123.       }
  124.    } else if(!IdentifyBase) {
  125.       if(sysentry = genentry(first,&previous,&syscnt)) {
  126.          strcpy (sysentry->syse_line,ESC "8identify.library not available!");
  127.       }
  128.    } else {
  129.       ULONG lastalert;
  130.  
  131.       IdHardwareUpdate();                 /* Liste auf dem aktuellsten Stand */
  132.  
  133.       if(sysentry = genentry(first,&previous,&syscnt)) {
  134.          strcpy (sysentry->syse_line,ESC "c" ESC "8-- HARDWARE --");
  135.       }
  136.       genentry(first,&previous,&syscnt);
  137.  
  138.       if(sysentry = genentry(first,&previous,&syscnt)) {
  139.          strcpy (sysentry->syse_desc,"System");
  140.          _sprintf(sysentry->syse_line,"%s",IdHardware(IDHW_SYSTEM,NULL));
  141.       }
  142.       genentry(first,&previous,&syscnt);
  143.       if(sysentry = genentry(first,&previous,&syscnt)) {
  144.          strcpy (sysentry->syse_desc,"Processor");
  145.          if(MyIdCheck(IDHW_CPUREV))
  146.            _sprintf(sysentry->syse_line,"CPU: %s / %s (ID $%04lx, Rev %s)", MyIdHardware(IDHW_CPU), MyIdHardware(IDHW_CPUCLOCK), pcr>>16, MyIdHardware(IDHW_CPUREV));
  147.          else
  148.            _sprintf(sysentry->syse_line,"CPU: %s / %s", MyIdHardware(IDHW_CPU), MyIdHardware(IDHW_CPUCLOCK));
  149.       }
  150.  
  151.       if(MyIdCheck(IDHW_FPU)) {
  152.         if(sysentry = genentry(first,&previous,&syscnt)) {
  153.            _sprintf(sysentry->syse_line,"FPU: %s / %s", MyIdHardware(IDHW_FPU), MyIdHardware(IDHW_FPUCLOCK));
  154.         }
  155.       }
  156.  
  157.       if(MyIdCheck(IDHW_MMU)) {
  158.         if(sysentry = genentry(first,&previous,&syscnt)) {
  159.            _sprintf(sysentry->syse_line,"MMU: %s", MyIdHardware(IDHW_MMU));
  160.         }
  161.       }
  162.  
  163.       if(MyIdCheck(IDHW_POWERPC)) {
  164.         if(sysentry = genentry(first,&previous,&syscnt)) {
  165.            _sprintf(sysentry->syse_line,"PPC: %s / %s", MyIdHardware(IDHW_POWERPC), MyIdHardware(IDHW_PPCCLOCK));
  166.         }
  167.       }
  168.  
  169.       genentry(first,&previous,&syscnt);
  170.       if(sysentry = genentry(first,&previous,&syscnt)) {
  171.          strcpy (sysentry->syse_desc,"Chipset");
  172.          _sprintf(sysentry->syse_line,"%s, RamSey %s, Gary %s",MyIdHardware(IDHW_CHIPSET),MyIdHardware(IDHW_RAMSEY),MyIdHardware(IDHW_GARY));
  173.       }
  174.       if(sysentry = genentry(first,&previous,&syscnt)) {
  175.          _sprintf(sysentry->syse_line,"ChunkyPlanar %s, BattClock %s",MyIdHardware(IDHW_CHUNKYPLANAR),MyIdHardware(IDHW_BATTCLOCK));
  176.       }
  177.       if(sysentry = genentry(first,&previous,&syscnt)) {
  178.          strcpy (sysentry->syse_desc,"Mother RAM");
  179.          _sprintf(sysentry->syse_line,"%s Bit, %s Access, %s CAS, %sx Bandwidth",MyIdHardware(IDHW_RAMWIDTH),MyIdHardware(IDHW_RAMACCESS),MyIdHardware(IDHW_RAMCAS),MyIdHardware(IDHW_RAMBANDWIDTH));
  180.       }
  181.       if(sysentry = genentry(first,&previous,&syscnt)) {
  182.          strcpy (sysentry->syse_desc,"Frequencies");
  183.          _sprintf(sysentry->syse_line,"VBlank %s, Power %s, E %s",MyIdHardware(IDHW_VBLANKFREQ),MyIdHardware(IDHW_POWERFREQ),MyIdHardware(IDHW_ECLOCK));
  184.       }
  185.  
  186.       if(attn & AFF_68010) {
  187.          ULONG cache = CacheControl(0,0);
  188.  
  189.          genentry(first,&previous,&syscnt);
  190.          genentry(first,&previous,&syscnt);
  191.          if(sysentry = genentry(first,&previous,&syscnt)) {
  192.             strcpy (sysentry->syse_line,ESC "c" ESC "8-- REGISTERS --");
  193.          }
  194.          genentry(first,&previous,&syscnt);
  195.  
  196.          if(sysentry = genentry(first,&previous,&syscnt)) {
  197.             _sprintf(sysentry->syse_line,"VBR  $%08lx",GetVBR());
  198.          }
  199.  
  200.          if(attn & AFF_68020)
  201.          {
  202.             if(sysentry = genentry(first,&previous,&syscnt)) {
  203.                _sprintf(sysentry->syse_line,"CACR $%08lx",cacr);
  204.             }
  205.          }
  206.  
  207.          if(attn & AFF_68060)
  208.          {
  209.             if(sysentry = genentry(first,&previous,&syscnt)) {
  210.                _sprintf(sysentry->syse_line,"PCR  $%08lx",pcr);
  211.             }
  212.          }
  213.          genentry(first,&previous,&syscnt);
  214.  
  215.          if(attn & AFF_68020) {
  216.             if(sysentry = genentry(first,&previous,&syscnt)) {
  217.                strcpy(sysentry->syse_desc,"Inst Cache");
  218.                if(cache&CACRF_EnableI){
  219.                   strcpy(sysentry->syse_line,"Enabled ");
  220.                   if((attn&AFF_68030) && (!(attn&AFF_68040)) && (cache&CACRF_IBE)) strcat(sysentry->syse_line,"Burst ");
  221.                   if(cache&CACRF_FreezeI) strcat(sysentry->syse_line,"Frozen ");
  222.                   if((attn&AFF_68060) && (cacr&(1<<13))) strcat(sysentry->syse_line,"Half ");
  223.                 }else{
  224.                   strcpy(sysentry->syse_line,"Disabled");
  225.                 }
  226.             }
  227.          }
  228.  
  229.          if(attn & AFF_68030) {
  230.             if(sysentry = genentry(first,&previous,&syscnt)) {
  231.                strcpy(sysentry->syse_desc,"Data Cache");
  232.                if(cache&CACRF_EnableD){
  233.                   strcpy(sysentry->syse_line,"Enabled ");
  234.                   if((attn&AFF_68030) && (!(attn&AFF_68040)) && (cache&CACRF_DBE)) strcat(sysentry->syse_line,"Burst ");
  235.                   if(cache&CACRF_FreezeD) strcat(sysentry->syse_line,"Frozen ");
  236.                   if((attn&AFF_68060) && (cacr&(1<<27))) strcat(sysentry->syse_line,"Half ");
  237.                   if((attn&AFF_68030) && (!(attn&AFF_68040)) && (cache&CACRF_WriteAllocate)) strcat(sysentry->syse_line,"Allocate ");
  238.                 }else{
  239.                   strcpy(sysentry->syse_line,"Disabled");
  240.                 }
  241.             }
  242.          }
  243.  
  244.          if((attn&AFF_68040) && (!(attn&AFF_68060)) && (cache&CACRF_CopyBack)){
  245.             if(sysentry = genentry(first,&previous,&syscnt)) {
  246.                strcpy(sysentry->syse_line,"CopyBack");
  247.             }
  248.          }
  249.          if(cache&CACRF_EnableE){
  250.             if(sysentry = genentry(first,&previous,&syscnt)) {
  251.                strcpy(sysentry->syse_line,"External Cache");
  252.             }
  253.          }
  254.          if(attn & AFF_68060)
  255.          {
  256.             if(pcr&(1<<0))
  257.               if(sysentry = genentry(first,&previous,&syscnt)) {
  258.                  strcpy(sysentry->syse_line,"Superscalar");
  259.               }
  260.             if(cacr&(1<<23))
  261.               if(sysentry = genentry(first,&previous,&syscnt)) {
  262.                  strcpy(sysentry->syse_line,"Branch Cache");
  263.               }
  264.             if(cacr&(1<<29))
  265.               if(sysentry = genentry(first,&previous,&syscnt)) {
  266.                  strcpy(sysentry->syse_line,"Store Buffer");
  267.               }
  268.             if(cacr&(1<<28))
  269.               if(sysentry = genentry(first,&previous,&syscnt)) {
  270.                  strcpy(sysentry->syse_line,"CPUSH invalidation disabled");
  271.               }
  272.             if(pcr&(1<<1))
  273.               if(sysentry = genentry(first,&previous,&syscnt)) {
  274.                  strcpy(sysentry->syse_line,"FPU disabled");
  275.               }
  276.          }
  277.       }
  278.  
  279.       genentry(first,&previous,&syscnt);
  280.       genentry(first,&previous,&syscnt);
  281.       if(sysentry = genentry(first,&previous,&syscnt)) {
  282.          BPTR lock;
  283.  
  284.          if (lock = Lock("RAM:", SHARED_LOCK)) {
  285.             struct InfoData *id;
  286.  
  287.             if (id = AllocVec(sizeof(struct InfoData), MEMF_CLEAR)) {
  288.                 if (Info(lock, id)) {
  289.                     struct DeviceList *ramDev;
  290.                     ULONG currentTime, bootTime, upTime;
  291.                     struct DateStamp ds;
  292.                     struct DateTime dt;
  293.                     UBYTE dateStr[LEN_DATSTRING], timeStr[LEN_DATSTRING];
  294.  
  295.                     ramDev = BADDR(id->id_VolumeNode);
  296.                     DateToInt(&ramDev->dl_VolumeDate, &bootTime);
  297.  
  298.                     DateStamp(&ds);
  299.                     DateToInt(&ds, ¤tTime);
  300.  
  301.                     upTime = currentTime - bootTime;
  302.  
  303.                     strcpy (sysentry->syse_line,ESC "c" ESC "8-- UPTIME --");
  304.  
  305.                     genentry(first,&previous,&syscnt);
  306.                     if(sysentry = genentry(first,&previous,&syscnt)) {
  307.                         IntToDate(currentTime, &dt.dat_Stamp);
  308.                         dt.dat_Format = FORMAT_DOS;
  309.                         dt.dat_Flags = 0;
  310.                         dt.dat_StrDay = NULL;
  311.                         dt.dat_StrDate = dateStr;
  312.                         dt.dat_StrTime = timeStr;
  313.                         DateToStr(&dt);
  314.  
  315.                         strcpy (sysentry->syse_desc,"Current time");
  316.                         _sprintf(sysentry->syse_line,"%s %s", dateStr, timeStr);
  317.                     }
  318.                     if(sysentry = genentry(first,&previous,&syscnt)) {
  319.                         IntToDate(bootTime, &dt.dat_Stamp);
  320.                         dt.dat_Format = FORMAT_DOS;
  321.                         dt.dat_Flags = 0;
  322.                         dt.dat_StrDay = NULL;
  323.                         dt.dat_StrDate = dateStr;
  324.                         dt.dat_StrTime = timeStr;
  325.                         DateToStr(&dt);
  326.  
  327.                         strcpy (sysentry->syse_desc,"Boot time");
  328.                         _sprintf(sysentry->syse_line,"%s %s", dateStr, timeStr);
  329.                     }
  330.                     if(sysentry = genentry(first,&previous,&syscnt)) {
  331.                         IntToDate(upTime, &dt.dat_Stamp);
  332.                         dt.dat_Format = FORMAT_DOS;
  333.                         dt.dat_Flags = 0;
  334.                         dt.dat_StrDay = NULL;
  335.                         dt.dat_StrDate = NULL;
  336.                         dt.dat_StrTime = timeStr;
  337.                         DateToStr(&dt);
  338.  
  339.                         strcpy (sysentry->syse_desc,"Uptime");
  340.                         _sprintf(sysentry->syse_line,"%4ld days, %s hours", dt.dat_Stamp.ds_Days, timeStr);
  341.                     }
  342.                 }
  343.  
  344.                 FreeVec(id);
  345.             }
  346.  
  347.             UnLock(lock);
  348.          }
  349.       }
  350.  
  351.       genentry(first,&previous,&syscnt);
  352.       genentry(first,&previous,&syscnt);
  353.       if(sysentry = genentry(first,&previous,&syscnt)) {
  354.          strcpy (sysentry->syse_line,ESC "c" ESC "8-- VERSIONS --");
  355.       }
  356.       genentry(first,&previous,&syscnt);
  357.  
  358.       if(sysentry = genentry(first,&previous,&syscnt)) {
  359.          strcpy (sysentry->syse_desc,"AmigaOS");
  360.          _sprintf(sysentry->syse_line,"%s (= %s), SetPatch %s, ROM %s",MyIdHardware(IDHW_OSNR),MyIdHardware(IDHW_OSVER),MyIdHardware(IDHW_SETPATCHVER),MyIdHardware(IDHW_ROMSIZE));
  361.       }
  362.       if(sysentry = genentry(first,&previous,&syscnt)) {
  363.          strcpy (sysentry->syse_desc,"Exec");
  364.          _sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_EXECVER));
  365.       }
  366.       if(sysentry = genentry(first,&previous,&syscnt)) {
  367.          strcpy (sysentry->syse_desc,"Workbench");
  368.          _sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_WBVER));
  369.       }
  370.       if(sysentry = genentry(first,&previous,&syscnt)) {
  371.          strcpy (sysentry->syse_desc,"Graphics");
  372.          _sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_GFXSYS));
  373.       }
  374.       if(sysentry = genentry(first,&previous,&syscnt)) {
  375.          strcpy (sysentry->syse_desc,"Audio");
  376.          _sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_AUDIOSYS));
  377.       }
  378.       if(sysentry = genentry(first,&previous,&syscnt)) {
  379.          strcpy (sysentry->syse_desc,"TCP/IP");
  380.          _sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_TCPIP));
  381.       }
  382.       if(sysentry = genentry(first,&previous,&syscnt)) {
  383.          strcpy (sysentry->syse_desc,"PowerPC-OS");
  384.          _sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_PPCOS));
  385.       }
  386.  
  387.       genentry(first,&previous,&syscnt);
  388.       genentry(first,&previous,&syscnt);
  389.       if(sysentry = genentry(first,&previous,&syscnt)) {
  390.          strcpy (sysentry->syse_line,ESC "c" ESC "8-- MEMORY --");
  391.       }
  392.       genentry(first,&previous,&syscnt);
  393.       if(sysentry = genentry(first,&previous,&syscnt)) {
  394.          strcpy(sysentry->syse_line," Chip       Fast      TOTAL");
  395.       }
  396.       if(sysentry = genentry(first,&previous,&syscnt)) {
  397.          strcpy (sysentry->syse_desc,"Plain");
  398.          _sprintf(sysentry->syse_line,"%9s  %9s  %9s",MyIdHardware(IDHW_PLNCHIPRAM),MyIdHardware(IDHW_PLNFASTRAM),MyIdHardware(IDHW_PLNRAM));
  399.       }
  400.       if(sysentry = genentry(first,&previous,&syscnt)) {
  401.          strcpy (sysentry->syse_desc,"Virtual");
  402.          _sprintf(sysentry->syse_line,"%9s  %9s  %9s",MyIdHardware(IDHW_VMMCHIPRAM),MyIdHardware(IDHW_VMMFASTRAM),MyIdHardware(IDHW_VMMRAM));
  403.       }
  404.       if(sysentry = genentry(first,&previous,&syscnt)) {
  405.          strcpy (sysentry->syse_desc,"TOTAL");
  406.          _sprintf(sysentry->syse_line,"%9s  %9s  %9s",MyIdHardware(IDHW_CHIPRAM),MyIdHardware(IDHW_FASTRAM),MyIdHardware(IDHW_RAM));
  407.       }
  408.       genentry(first,&previous,&syscnt);
  409.       if(sysentry = genentry(first,&previous,&syscnt)) {
  410.          _sprintf(sysentry->syse_line,"SlowRAM: %s",MyIdHardware(IDHW_SLOWRAM));
  411.       }
  412.  
  413.       lastalert = IdHardwareNum(IDHW_LASTALERT,NULL);
  414.       if(lastalert != 0xFFFFFFFF) {
  415.          genentry(first,&previous,&syscnt);
  416.          genentry(first,&previous,&syscnt);
  417.          if(sysentry = genentry(first,&previous,&syscnt)) {
  418.             strcpy (sysentry->syse_line,ESC "c" ESC "8-- LAST ALERT --");
  419.          }
  420.          genentry(first,&previous,&syscnt);
  421.          if(sysentry = genentry(first,&previous,&syscnt)) {
  422.             strcpy (sysentry->syse_desc,"Alert Code");
  423.             _sprintf(sysentry->syse_line,"%08lx",lastalert);
  424.          }
  425.          if(sysentry = genentry(first,&previous,&syscnt)) {
  426.             strcpy (sysentry->syse_desc,"Deadend");
  427.             IdAlertTags(lastalert,IDTAG_DeadStr,sysentry->syse_line,TAG_DONE);
  428.          }
  429.          if(sysentry = genentry(first,&previous,&syscnt)) {
  430.             strcpy (sysentry->syse_desc,"Sub System");
  431.             IdAlertTags(lastalert,IDTAG_SubsysStr,sysentry->syse_line,TAG_DONE);
  432.          }
  433.          if(sysentry = genentry(first,&previous,&syscnt)) {
  434.             strcpy (sysentry->syse_desc,"General");
  435.             IdAlertTags(lastalert,IDTAG_GeneralStr,sysentry->syse_line,TAG_DONE);
  436.          }
  437.          if(sysentry = genentry(first,&previous,&syscnt)) {
  438.             strcpy (sysentry->syse_desc,"Specific");
  439.             IdAlertTags(lastalert,IDTAG_SpecStr,sysentry->syse_line,TAG_DONE);
  440.          }
  441.       }
  442.    }
  443.    return (syscnt);
  444. }
  445.  
  446. void PrintSystem (char *filename) {
  447.    int   i=1;
  448.    BPTR  handle;
  449.    struct SystemEntry *entryp = NULL;
  450.    STRPTR desc,line;
  451.  
  452.    handle = HandlePrintStart (filename);
  453.    if (handle) {
  454.       if (! WI_System) {
  455.          i = GetSystem (&entryp);
  456.       }
  457.       if (i) {
  458.          for (i=0;;i++) {
  459.             if (WI_System)
  460.                DoMethod (syslist,MUIM_List_GetEntry,i,&entryp);
  461.             if (!entryp) break;
  462.  
  463.             desc = entryp->syse_desc; while(*desc=='\33') desc+=2;
  464.             line = entryp->syse_line; while(*line=='\33') line+=2;
  465.  
  466.             _sprintf (tmpstr2, " %15s  %s\n",desc,line);
  467.             if (! (PrintOneLine (handle, tmpstr2)))
  468.                break;
  469.  
  470.             if (! WI_System)
  471.                entryp = entryp->syse_next;
  472.          }
  473.       }
  474.    }
  475.    HandlePrintStop();
  476. }
  477.  
  478. void ShowSystem (void) {
  479.    struct SystemEntry *syse;
  480.  
  481.    ApplicationSleep();
  482.    set (syslist,MUIA_List_Quiet,TRUE);
  483.  
  484.    FreeSystem();
  485.    GetSystem(&syse);
  486.  
  487.    while (syse) {
  488.       InsertBottomEntry (syslist, (APTR *) &syse);
  489.       syse = syse->syse_next;
  490.    }
  491.  
  492.    AwakeApplication();
  493.    set (syslist,MUIA_List_Quiet,FALSE);
  494. }
  495.  
  496. void SendSystemList (void) {
  497.    struct   SystemEntry   *syse;
  498.  
  499.    FreeSystem();
  500.    GetSystem (&syse);
  501.  
  502.    while (syse) {
  503.       SendEncodedEntry ((UBYTE *) syse, sizeof (struct SystemEntry));
  504.       syse = syse->syse_next;
  505.    }
  506.    FreeSystem();
  507. }
  508.  
  509.  
  510. APTR WI_System, syslist, systext;
  511.  
  512. char system_title[WINDOWTITLELEN];
  513.  
  514. void SystemWindow (BOOL state) {
  515.    if (state) {
  516.       if (WI_System) {
  517.          ShowSystem();
  518.       } else {
  519.          WI_System = WindowObject,
  520.          MUIA_Window_Title, MyGetWindowTitle (system_title, "SYSTEM"),
  521.          MUIA_HelpNode, SystemText,
  522.          MUIA_Window_ID, MakeListID('S','Y','S','T'),
  523.          WindowContents, VGroup,
  524.             Child, syslist = ListviewObject,
  525.                MUIA_Listview_Input, FALSE,
  526.                MUIA_Listview_List, ListObject,
  527.                   MUIA_Font, MUIV_Font_Fixed,
  528.                   ReadListFrame,
  529.                   MUIA_List_Format, "DELTA=8 BAR P=\33r,",
  530.                   MUIA_List_DisplayHook, &syslist_dsphook,
  531.                End,
  532.                MUIA_CycleChain, TRUE,
  533.             End,
  534.             Child, MyVSpace(2),
  535.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  536.                Child, BT_SysUpdate = KeyButtonA (UpdateText,ID_SYSUPDATE),
  537.                Child, BT_SysPrint  = KeyButtonA (PrintText ,ID_SYSPRINT),
  538.                Child, BT_SysExit   = KeyButtonA (ExitText  ,ID_SYSEXIT),
  539.             End,
  540.          End, End;
  541.  
  542.  
  543.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_System);
  544.          DoMethod (WI_System,MUIM_Window_SetCycleChain,syslist,BT_SysUpdate, BT_SysPrint,BT_SysExit,NULL);
  545.          SetCloseRequest (WI_System,ID_SYSEXIT);
  546.  
  547.          ShowSystem();
  548.  
  549.          SetWindowOpen (WI_System,syslist,ID_SYSEXIT);
  550.       }
  551.    } else if ((! state) && (WI_System)) {
  552.       SetWindowClose (WI_System,TRUE);
  553.       FreeSystem();
  554.       DoMethod (AP_Scout,OM_REMMEMBER,WI_System);
  555.       MUI_DisposeObject (WI_System);
  556.       WI_System = NULL;
  557.    }
  558. }
  559.  
  560.